
    $(function () {
        var ttime = $("#timelimt").val();
        show_time(ttime*60);
        $("#sub").click(function () {
            popBox1();
        });
    });

function show_time(totalTime) {
    if (totalTime == 0) {
        clearTimeout(t);
        popBox();
        return true;
    }
    var remainTime = totalTime - 1;
    var min = remainTime / 60;
    min = parseInt(min);
    var s = remainTime % 60;
    if (s < 10) {
        s = "0" + s;
    }
    var str = "0" + min + ":" + s;
    $("#curtime").text(str);
    t = setTimeout("show_time(" + remainTime + ")", 1000);
}

function popBox(){
    var msg = document.getElementById('msg');
    var popLayer = document.getElementById('popLayer');
    popLayer.style.display = "block";
    msg.style.display = "block";
}//end func popBox()

function closeBox(){
    $("form[name='examform']").submit();
    var popBox = document.getElementById('msg');
    var popLayer = document.getElementById('popLayer');
    popLayer.style.display = "none";
    popBox.style.display = "none";
}//end func closeBox()

function popBox1(){
    var finexam = document.getElementById('finexam');
    var popLayer = document.getElementById('popLayer');
    popLayer.style.display = "block";
    finexam.style.display = "block";
}//end func popBox()

function comfirmBox(){
    $("form[name='examform']").submit();
    var finexam = document.getElementById('finexam');
    var popLayer = document.getElementById('popLayer');
    popLayer.style.display = "none";
    finexam.style.display = "none";
}//end func closeBox()

function cancelBox(){
    var finexam = document.getElementById('finexam');
    var popLayer = document.getElementById('popLayer');
    popLayer.style.display = "none";
    finexam.style.display = "none";
}//end func closeBox()
